package com.sky.mapper;

import com.sky.entity.DishFlavor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

// 注意：启动类上必须添加@MapperScan注解，可以省略@Mapper注解。否则无法扫描到该接口
public interface DishFlavorMapper {
    /**
     * 批量插入口味数据
     * @param dishFlavors
     */
    void insertBatch(List<DishFlavor> dishFlavors);

    /**
     * 根据菜品id删除对应的口味数据
     * @param dishIds
     */
    void deleteBatch(List<Integer> dishIds);

    /**
     * 根据菜品id查询对应的口味数据
     * @param dishId
     * @return
     */
    @Select("select * from dish_flavor where dish_id = #{dishId}")
    List<DishFlavor> getByDishId(Integer dishId);

    /**
     * 根据菜品dishId删除对应的口味数据
     * @param dishId
     */
    @Select("delete from dish_flavor where dish_id = #{dishId}")
    void deleteByDishId(Long dishId);
}
